home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Standard Catalog Package / DTS AddressOMatic / Src / AOMVampDisplay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-05  |  1.9 KB  |  92 lines  |  [TEXT/KAHL]

  1. /*                                AOMVampDisplay.c                                */
  2. /*    
  3.  * AddressOMatic Sample
  4.  * AOMSpinner.c
  5.  * Copyright © 1993 Apple Computer Inc. All rights reserved.
  6.  */
  7. #include "IconSuite.h"
  8. #include "AddressOMaticPrivate.h"
  9. /*
  10.  * This must be loaded into the MPW main segment
  11.  */
  12. #pragma segment MainCode
  13.  
  14. void                            _AOMAnimateSpinner(
  15.         register AddressOMaticPtr    aomPtr,
  16.         unsigned long                now
  17.     );
  18.  
  19. pascal void
  20. _AOMAnimatePanel(
  21.         SDPPanelHandle                panelHandle,
  22.         Boolean                        busy
  23.     )
  24. {
  25.         register AddressOMaticPtr    aomPtr;
  26.         unsigned long                now;
  27.         
  28.         aomPtr = (AddressOMaticPtr) (**panelHandle).refCon;
  29.         now = TickCount();
  30.         if (busy && now >= AOM.nextAnimation)
  31.             _AOMAnimateSpinner(aomPtr, now);
  32. }
  33.  
  34. pascal void
  35. _AOMAnimateFindPanel(
  36.         SDPFindPanelHandle            findPanelHandle,
  37.         Boolean                        busy
  38.     )
  39. {
  40.         register AddressOMaticPtr    aomPtr;
  41.         unsigned long                now;
  42.  
  43.         aomPtr = (AddressOMaticPtr) (**findPanelHandle).refCon;
  44.         now = TickCount();
  45.         if (busy && now >= AOM.nextAnimation)
  46.             _AOMAnimateSpinner(aomPtr, now);
  47. }
  48.  
  49. /*
  50.  * AnimateSpinner does all the work. It is called repeatedly to
  51.  * update the icon display.
  52.  */
  53. void
  54. _AOMAnimateSpinner(
  55.         register AddressOMaticPtr    aomPtr,
  56.         unsigned long                now
  57.     )
  58. {
  59.         AOM.nextAnimation = now + kSpinnerDelay;
  60. #ifdef kFirstSpinnerIcon        /* Defined in Beta 3    */
  61.         ++AOM.animationSICNIndex;
  62.         if (AOM.animationSICNIndex > kLastSpinnerIcon)
  63.             AOM.animationSICNIndex = kFirstSpinnerIcon;
  64. #endif
  65.         _AOMUpdateSpinner(aomPtr);            
  66. }
  67.  
  68. /*
  69.  * _AOMUpdateSpinner is called to draw or redraw the spinner icon
  70.  */
  71. void
  72. _AOMUpdateSpinner(
  73.         register AddressOMaticPtr    aomPtr
  74.     )
  75. {
  76. #ifdef kFirstSpinnerIcon        /* Defined in Beta 3    */
  77.         AOMSaveState                saveState;
  78.         
  79.         _AOMSaveState(aomPtr, kAOMLabelFontStyle, &saveState);
  80.         (void) PlotIconID(
  81.                     &RECT(kAOMSpinnerItem),
  82.                     atNone,
  83.                     ttNone,
  84.                     AOM.animationSICNIndex
  85.                 );
  86.         _AOMRestoreState(&saveState);
  87. #else
  88. #pragma unused (aomPtr)
  89. #endif
  90. }
  91.  
  92.